<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>LinkedChat招聘网</title>
  <link rel="stylesheet" href="${pageContext.request.contextPath}/public/static/css/Login.css">
  <script src="${pageContext.request.contextPath}/public/static/js/jquery-3.6.0.min.js"></script>
    <link href="${pageContext.request.contextPath}/public/static/images/login_icon.ico" rel="shortcut icon">
</head>
<body>
<div class="img">
  <div class="log register">
    <div class="myk">
      <div id="logs">
        登&nbsp;&nbsp;录
      </div>

      <!-- 登录身份选择 -->
      <div class="formItem3">
        <input type="button" value="我要找工作" class="butto1">
        <input type="button" id="backStageBtn" value="我要招聘" class="butto2">
      </div>

      <!-- 手机号输入框  -->
      <div class="formItem2">
        <label class="yonghu">手机号：</label>
        <input type="text" id="telno" class="textinput userpho"placeholder="请输入手机号"  >
<%--          18550385036--%>
      </div>
      <i class="msgTip2 userphoTip"> </i>
    
      <div class="formItem2">
        <label  class="yonghu" >&nbsp;密&nbsp;&nbsp;码&nbsp;：</label>
        <input type="password"class="textinput userpwd" id="pwd" placeholder="请输入密码" value="${result.data.personPasswoed}">
      </div>
      <i class="msgTip2 userpwdTip"> </i>

      <!-- 登录button -->
      <button class="inputs"  id="userLoginBt"><a href="javascript:void(0)" style="text-decoration: none;color: black;">登&nbsp;&nbsp;录</a></button>

      <div class="regis">
        <div class="rememberPas">
          <input class="selCheckbox" type="checkbox" value="" name=""> 记住密码</div>
        <a href="../Person/Register.jsp">没有账号？去注册</a></div>
    </div>

  </div>
</div>
<script src="${pageContext.request.contextPath}/public/static/js/login.js"></script>
<script>
    //我要招聘按钮跳转
    $("#backStageBtn").click(function (){
        location.href = "${pageContext.request.contextPath}/jsp/backStageLogin.jsp";
    })


    var personTel =sessionStorage.getItem("personTel")
    var personPassword=sessionStorage.getItem("personPassword")
    console.log(personTel)
    console.log(personPassword)
    $(".userpho").val(personTel)
    $(".userpwd").val(personPassword)

   $("#userLoginBt").click(function () {
       console.log("1111111111111")
        $.ajax({
            type:"post",
            url:"${pageContext.request.contextPath}/checkLoginToken",//对应连接controller中的方法调用
            data:{
                // personTel,personPassword对应实体类的属性名称
                personTel:$(".userpho").val(),
                personPassword:$(".userpwd").val()
            },

            success:function (result) {
                console.log("login-js》》》success result:"+result);
                //    保存信息到本地，信息都转换token
                var token = result.data;
                console.log("信息都转换token>>>"+token);

                localStorage.setItem("token",token);//保存到token
                //信息验证成功，转换为token后，跳转到index.jsp页面
                <%--location.href = "${pageContext.request.contextPath}/public/Person/PersonCenter.jsp";--%>
                console.log("登录成功,请去完善个人信息")
                window.alert("登录成功,请去完善个人信息")
                window.location.href="${pageContext.request.contextPath}/public/Person/PersonCenter.jsp"
            }
        })

    })

</script>
</body>
</html>